package com.symaster.common.geom.canvas.repeater;

import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

/**
 * @author yinmiao
 * @version 2022-07-14 15:20
 */
public class CanvasMouseListenerRepeater extends BaseRepeater implements MouseListener {
    private final MouseListener dstRepeater;

    public CanvasMouseListenerRepeater(Component component, MouseListener dstRepeater) {
        super(component);
        this.dstRepeater = dstRepeater;
    }

    @Override
    public void mouseClicked(MouseEvent e) {
        dstRepeater.mouseClicked(generateRepeaterMouseEvent(e));
    }

    @Override
    public void mousePressed(MouseEvent e) {
        dstRepeater.mousePressed(generateRepeaterMouseEvent(e));
    }

    @Override
    public void mouseReleased(MouseEvent e) {
        dstRepeater.mouseReleased(generateRepeaterMouseEvent(e));
    }

    @Override
    public void mouseEntered(MouseEvent e) {
        dstRepeater.mouseEntered(generateRepeaterMouseEvent(e));
    }

    @Override
    public void mouseExited(MouseEvent e) {
        dstRepeater.mouseExited(generateRepeaterMouseEvent(e));
    }
}
